<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <meta charset="utf-8">
  <title>我的消息</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="/resource/layui/css/layui.css">
  <link rel="stylesheet" href="/resource/css/global.css">
</head>
<body>

<div class="fly-header layui-bg-green">
  <div class="layui-container">
    <a class="fly-logo" href="/user/redirectIndex.do">
      <div class="layui-logo" style="font-size: 20px; color: #CAE1FF;"><span class="iconfont-ali icon-B" style="font-size: 35px"></span></div>
    </a>
    <ul class="layui-nav fly-nav layui-hide-xs">
      <li class="layui-nav-item layui-this">
        <a href="/user/redirectIndex.do"><i class="layui-icon  layui-icon-home"></i>首页</a>
      </li>
    </ul>
    
    <ul class="layui-nav fly-nav-user">
      <!-- 登入后的状态 -->
      <li class="layui-nav-item">
        <a class="fly-nav-avatar" href="/user/redirectIndex.do">
          <cite class="layui-hide-xs">${user.userName}</cite>
          <img <c:if test="${!empty user.headSculpture }">src="${user.headSculpture }"</c:if><c:if test="${empty user.headSculpture }">src="/resource/img/logo.JPG"</c:if> alt="${user.userName}">
        </a>
        <dl class="layui-nav-child layui-bg-green">
       	  <dd><a href="/user/userindex.do"><i class="layui-icon">&#xe609;</i>用户中心</a></dd>
          <dd><a href="/user/userset.do"><i class="layui-icon">&#xe620;</i>基本设置</a></dd>
          <dd><a href="/user/usermessage.do"><i class="iconfont icon-tongzhi" style="top: 4px;"></i>我的消息</a></dd>
          <dd><a href="/user/userhome.do"><i class="layui-icon" style="margin-left: 2px; font-size: 22px;">&#xe68e;</i>我的主页</a></dd>
          <hr style="margin: 5px 0;">
          <dd><a href="/user/logout.do" ><i class="iconfont-ali icon-tuichu"></i>退出</a></dd>
        </dl>
      </li>
    </ul>
  </div>
</div>

<div class="layui-container fly-marginTop fly-user-main">
  <ul class="layui-nav layui-nav-tree layui-inline" lay-filter="user">
    <li class="layui-nav-item">
      <a href="/user/userhome.do">
        <i class="layui-icon">&#xe609;</i>
        我的主页
      </a>
    </li>
    <li class="layui-nav-item">
      <a href="/user/userindex.do">
        <i class="layui-icon">&#xe612;</i>
        用户中心
      </a>
    </li>
    <li class="layui-nav-item">
      <a href="/user/userset.do">
        <i class="layui-icon">&#xe620;</i>
        基本设置
      </a>
    </li>
    <li class="layui-nav-item layui-this">
      <a href="/user/usermessage.do">
        <i class="layui-icon">&#xe611;</i>
        我的消息
      </a>
    </li>
  </ul>

  <div class="site-tree-mobile layui-hide">
    <i class="layui-icon">&#xe602;</i>
  </div>
  <div class="site-mobile-shade"></div>
  
  <div class="site-tree-mobile layui-hide">
    <i class="layui-icon">&#xe602;</i>
  </div>
  <div class="site-mobile-shade"></div>
  
  
  <div class="fly-panel fly-panel-user" pad20>
	  <div class="layui-tab layui-tab-brief" lay-filter="user" id="LAY_msg" style="margin-top: 15px;">
	    <button class="layui-btn layui-btn-danger" id="B_delallmsg">清空全部消息</button>
	    <div  id="LAY_minemsg" style="margin-top: 10px;">
        <ul class="mine-msg">
        <!-- 消息循环开始 -->
        <c:if test="${!empty messages}">
        <c:forEach items="${messages }" var="message">
          <li >
            <blockquote class="layui-elem-quote">
             ${message.messageContent }
            </blockquote>
            <p><span>${message.messageDate }</span><a name="delete" id="${message.messageId }" class="layui-btn layui-btn-small layui-btn-danger fly-delete">删除</a></p>
          </li>
         </c:forEach>
         </c:if>
         <c:if test="${empty messages }">
		 	<div class="fly-none">您暂时没有最新消息</div>
		</c:if>
          <!-- 消息循环结束 -->
        </ul>
      </div>
	  </div>
	</div>

</div>


<div class="fly-footer">
  	<p>Believe 社区 2019 &copy; 千夜 出品</p>
</div>
<script type="text/javascript" src="/resource/js/jquery-3.4.0.min.js"></script>
<script type="text/javascript" src="/resource/js/common.js"></script>
<script src="/resource/layui/layui.js"></script>
<script type="text/javascript" src="/resource/js/usermessage.js"></script>
<script>
	//注意：导航 依赖 element 模块，否则无法进行功能性操作
	layui.use('element', function() {
		var element = layui.element;
	});
	//检测session是否过期  或者未登录
	layui.use('layer',function(){
		$(document).ready(function(){
			var se="${user}";
			if(se==""){
			layer.alert('登录过期或未登录，请登录', function(index){
				  window.location.href="/login.html";
				  layer.close(index);
				}); 
			}
		});
	});
</script>

</body>
</html>